package com.ruoyi.ring.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ring.mapper.RingSleepMapper;
import com.ruoyi.ring.domain.RingSleep;
import com.ruoyi.ring.service.IRingSleepService;

/**
 * 睡眠Service业务层处理
 * 
 * @author liuwp
 * @date 2025-08-18
 */
@Service
public class RingSleepServiceImpl implements IRingSleepService 
{
    @Autowired
    private RingSleepMapper ringSleepMapper;

    /**
     * 查询睡眠
     * 
     * @param id 睡眠主键
     * @return 睡眠
     */
    @Override
    public RingSleep selectRingSleepById(Long id)
    {
        return ringSleepMapper.selectRingSleepById(id);
    }

    /**
     * 查询睡眠列表
     * 
     * @param ringSleep 睡眠
     * @return 睡眠
     */
    @Override
    public List<RingSleep> selectRingSleepList(RingSleep ringSleep)
    {
        return ringSleepMapper.selectRingSleepList(ringSleep);
    }

    /**
     * 根据业务主键查询一条记录：睡眠
     *
     * @param ringSleep 睡眠
     * @return 睡眠
     */
    @Override
    public RingSleep selectOneRingSleep(RingSleep ringSleep)
    {
        return ringSleepMapper.selectOneRingSleep(ringSleep);
    }

    /**
     * 新增睡眠
     * 
     * @param ringSleep 睡眠
     * @return 结果
     */
    @Override
    public int insertRingSleep(RingSleep ringSleep)
    {
        ringSleep.setCreateTime(DateUtils.getNowDate());
        return ringSleepMapper.insertRingSleep(ringSleep);
    }

    /**
     * 修改睡眠
     * 
     * @param ringSleep 睡眠
     * @return 结果
     */
    @Override
    public int updateRingSleep(RingSleep ringSleep)
    {
        ringSleep.setUpdateTime(DateUtils.getNowDate());
        return ringSleepMapper.updateRingSleep(ringSleep);
    }

    @Override
    public int updateRingSleepCondition(RingSleep ringSleep, RingSleep ringSleepCondition)
    {
                ringSleep.setUpdateTime(DateUtils.getNowDate());
        return ringSleepMapper.updateRingSleepCondition(ringSleep, ringSleepCondition);
    }

    /**
     * 批量删除睡眠
     * 
     * @param ids 需要删除的睡眠主键
     * @return 结果
     */
    @Override
    public int deleteRingSleepByIds(Long[] ids)
    {
        return ringSleepMapper.deleteRingSleepByIds(ids);
    }

    /**
     * 删除睡眠信息
     * 
     * @param id 睡眠主键
     * @return 结果
     */
    @Override
    public int deleteRingSleepById(Long id)
    {
        return ringSleepMapper.deleteRingSleepById(id);
    }

    /**
     * 条件删除睡眠
     *
     * @param ringSleep 睡眠
     * @return 结果
     */
    @Override
    public int deleteRingSleepByCondition(RingSleep ringSleep)
    {
        return ringSleepMapper.deleteRingSleepByCondition(ringSleep);
    }

}
